package com.paw.portal.enums;

import java.io.Serializable;
import java.util.Arrays;

import com.paw.common.enums.ICommonEnum;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 菜单权限表
 * </p>
 *
 * @author Rubble
 * @since 2021-08-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="SysMenuEnums对象", description="菜单权限表Enums对象")
public class SysMenuEnums implements Serializable {

@Getter
@AllArgsConstructor
public enum MenuTypeEnum implements ICommonEnum {

  /**
   * 菜单类型（0：目录；1：菜单；2：按钮）
   */
  A0(0,"目录"),
  A1(1,"菜单"),
  A2(2,"按钮"),
  ;
  int code;
  String desc;

  public static MenuTypeEnum getEnumByCode (Integer code) {
    return code!=null?Arrays.stream(values()).filter(e->e.getCode()==code).findFirst().orElse(null):null;
  }

  public static String getDescByCode (Integer code) {
    return code!=null?Arrays.stream(values()).filter(e->e.getCode()==code).map(MenuTypeEnum::getDesc).findFirst().orElse(null):null;
  }
}
@Getter
@AllArgsConstructor
public enum HideInMenuEnum implements ICommonEnum {

  /**
   * 隐藏菜单（0：否；1：是）
   */
  A0(0,"否"),
  A1(1,"是"),
  ;
  int code;
  String desc;

  public static HideInMenuEnum getEnumByCode (Integer code) {
    return code!=null?Arrays.stream(values()).filter(e->e.getCode()==code).findFirst().orElse(null):null;
  }

  public static String getDescByCode (Integer code) {
    return code!=null?Arrays.stream(values()).filter(e->e.getCode()==code).map(HideInMenuEnum::getDesc).findFirst().orElse(null):null;
  }
}
@Getter
@AllArgsConstructor
public enum HideChildrenInMenuEnum implements ICommonEnum {

  /**
   * 隐藏子菜单（0：否；1：是）
   */
  A0(0,"否"),
  A1(1,"是"),
  ;
  int code;
  String desc;

  public static HideChildrenInMenuEnum getEnumByCode (Integer code) {
    return code!=null?Arrays.stream(values()).filter(e->e.getCode()==code).findFirst().orElse(null):null;
  }

  public static String getDescByCode (Integer code) {
    return code!=null?Arrays.stream(values()).filter(e->e.getCode()==code).map(HideChildrenInMenuEnum::getDesc).findFirst().orElse(null):null;
  }
}
}
